package com.twu.biblioteca;

import org.junit.Ignore;
import org.junit.Test;

import java.io.*;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class WrongCommandTest {

    @Ignore
    @Test
    public void should_get_output() throws Exception {
        // given
        BibliotecaApp app = new BibliotecaApp(System.in, System.out);
        String inputString = "wrong command\\nq";

        OutputStream outputStream = new ByteArrayOutputStream();
        System.setOut(new PrintStream(outputStream));
        System.setIn(new ByteArrayInputStream(inputString.getBytes()));
        System.setIn(new ByteArrayInputStream("q".getBytes()));

        // when
        app.start();
        String output = outputStream.toString();

        // then
        assertThat(output, is("Select a valid option!!"));
    }
}
